package com.ling.pl.security.controller;

import com.ling.pl.security.model.DefaultPosition;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

/**
 * @author bo.wang
 */
@RequestMapping("/defaultPosition")
@Api(value = "defaultPosition", description = "API")
@RestController("defaultPositionController")
public class DefaultPositionController extends BaseDefaultPositionController {

    Log log = LogFactory.getLog(DefaultPositionController.class);


    @ApiOperation(value = "loadPositionByUsername")
    @RequestMapping(value = "/loadPositionByUsername", method = RequestMethod.GET)
    public Collection<DefaultPosition> loadPositionByUsername(@ApiParam(value = "username") @PathVariable(name = "username") String username) {
        return defaultPositionService.loadUserPositions(username);
    }


    @ApiOperation(value = "uniqueCheck")
    @RequestMapping(value = "/uniqueCheck", method = RequestMethod.GET)
    public String uniqueCheck(@ApiParam(value = "id") @PathVariable(name = "id") String id) {
        return defaultPositionService.uniqueCheck(id);
    }
}

